package com.mofofa.maozy.repay

import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations
import com.mofofa.maozy.base.BaseViewModel
import com.mofofa.maozy.data.ReqBase
import com.mofofa.maozy.network.ApiUserReposity

class RepayViewModel : BaseViewModel() {

    /** 获取还款详情 */
    private val mMaozyFetchMaozyRepayMaozyDetailMaozyLiveData =
        MutableLiveData<ReqBase>()

    /** 判断是否需要还款 */
    private val mMaozyFetchMaozyIsMaozyRepayMaozyNowMaozyLiveData =
        MutableLiveData<ReqBase>()

    /** 获取还款链接-加纳 */
    private val mMaozyFetchMaozyRepayMaozyUrlMaozyGHAMaozyLiveData =
        MutableLiveData<ReqBase>()

    /** 获取还款链接-乌干达 */
    private val mMaozyFetchMaozyRepayMaozyUrlMaozyUGXMaozyLiveData =
        MutableLiveData<ReqBase>()

    /** 获取还款链接-肯尼亚 */
    private val mMaozyFetchMaozyRepayMaozyUrlMaozyKSHMaozyLiveData =
        MutableLiveData<ReqBase>()

    /** 获取还款链接-科特 */
    private val mMaozyFetchMaozyRepayMaozyUrlMaozyFCFAMaozyLiveData =
        MutableLiveData<ReqBase>()

    /** 获取还款链接-越南 */
    private val mMaozyFetchMaozyRepayMaozyUrlMaozyVNDMaozyLiveData =
        MutableLiveData<ReqBase>()

    /** 获取还款详情 */
    val onMaozyFetchMaozyRepayMaozyDetailMaozyLiveData =
        Transformations.switchMap(mMaozyFetchMaozyRepayMaozyDetailMaozyLiveData) { query ->
            ApiUserReposity.fetchMaozyRepayMaozyDetail(this, query)
        }

    /** 判断是否需要还款 */
    val onMaozyFetchMaozyIsMaozyRepayMaozyNowMaozyLiveData =
        Transformations.switchMap(
            mMaozyFetchMaozyIsMaozyRepayMaozyNowMaozyLiveData
        ) { query ->
            ApiUserReposity.fetchMaozyIsMaozyRepayMaozyNow(this, query)
        }

    /** 获取还款链接-加纳 */
    val onMaozyFetchMaozyRepayMaozyUrlMaozyGHAMaozyLiveData =
        Transformations.switchMap(
            mMaozyFetchMaozyRepayMaozyUrlMaozyGHAMaozyLiveData
        ) { query ->
            ApiUserReposity.fetchMaozyRepayMaozyUrlMaozyGHA(this, query)
        }

    /** 获取还款链接-乌干达 */
    val onMaozyFetchMaozyRepayMaozyUrlMaozyUGXMaozyLiveData =
        Transformations.switchMap(
            mMaozyFetchMaozyRepayMaozyUrlMaozyUGXMaozyLiveData
        ) { query ->
            ApiUserReposity.fetchMaozyRepayMaozyUrlMaozyUGX(this, query)
        }

    /** 获取还款链接-肯尼亚 */
    val onMaozyFetchMaozyRepayMaozyUrlMaozyKSHMaozyLiveData =
        Transformations.switchMap(
            mMaozyFetchMaozyRepayMaozyUrlMaozyKSHMaozyLiveData
        ) { query ->
            ApiUserReposity.fetchMaozyRepayMaozyUrlMaozyKSH(this, query)
        }

    /** 获取还款链接-科特 */
    val onMaozyFetchMaozyRepayMaozyUrlMaozyFCFAMaozyLiveData =
        Transformations.switchMap(
            mMaozyFetchMaozyRepayMaozyUrlMaozyFCFAMaozyLiveData
        ) { query ->
            ApiUserReposity.fetchMaozyRepayMaozyUrlMaozyFCFA(this, query)
        }

    /** 获取还款链接-越南 */
    val onMaozyFetchMaozyRepayMaozyUrlMaozyVNDMaozyLiveData =
        Transformations.switchMap(
            mMaozyFetchMaozyRepayMaozyUrlMaozyVNDMaozyLiveData
        ) { query ->
            ApiUserReposity.fetchMaozyRepayMaozyUrlMaozyVND(this, query)
        }

    /** 获取还款详情 */
    fun fetchMaozyRepayMaozyDetail(reqBase: ReqBase) {
        mMaozyFetchMaozyRepayMaozyDetailMaozyLiveData.value = reqBase
    }

    /** 获取还款链接-加纳 */
    fun fetchMaozyRepayMaozyUrlMaozyGHA(reqBase: ReqBase) {
        mMaozyFetchMaozyRepayMaozyUrlMaozyGHAMaozyLiveData.value = reqBase
    }

    /** 获取还款链接-乌干达 */
    fun fetchMaozyRepayMaozyUrlMaozyUGX(reqBase: ReqBase) {
        mMaozyFetchMaozyRepayMaozyUrlMaozyUGXMaozyLiveData.value = reqBase
    }

    /** 获取还款链接-肯尼亚 */
    fun fetchMaozyRepayMaozyUrlMaozyKSH(reqBase: ReqBase) {
        mMaozyFetchMaozyRepayMaozyUrlMaozyKSHMaozyLiveData.value = reqBase
    }

    /** 获取还款链接-科特 */
    fun fetchMaozyRepayMaozyUrlMaozyFCFA(reqBase: ReqBase) {
        mMaozyFetchMaozyRepayMaozyUrlMaozyFCFAMaozyLiveData.value = reqBase
    }

    /** 获取还款链接-越南 */
    fun fetchMaozyRepayMaozyUrlMaozyVND(reqBase: ReqBase) {
        mMaozyFetchMaozyRepayMaozyUrlMaozyVNDMaozyLiveData.value = reqBase
    }

    /** 判断是否需要还款 */
    fun fetchMaozyIsMaozyRepayMaozyNow(reqBase: ReqBase) {
        mMaozyFetchMaozyIsMaozyRepayMaozyNowMaozyLiveData.value = reqBase
    }
}